//
//  ActiverTableViewCell.m
//  记账本
//
//  Created by lirilu on 15/4/20.
//  Copyright (c) 2015年 glirlu@gmail.com. All rights reserved.
//

#import "ActiverTableViewCell.h"

@interface ActiverTableViewCell()
{
}
@end

@implementation ActiverTableViewCell

+ (BOOL) regestNib:(UITableView*) tabelView Identifier:(NSString *)identifier {
    static UINib *nib;
    if (nib == nil) {
        UINib *nib = [UINib nibWithNibName:NSStringFromClass(self) bundle:nil];
        [tabelView registerNib:nib forCellReuseIdentifier:identifier];
    }
    return YES;
}

+ (ActiverTableViewCell*) getCell:(UITableView*) tableView ArchiverData:(ArchiverData*)data{
    NSString *CellWithIdentifier = @"activerTableViewCell";
    [ActiverTableViewCell regestNib:tableView Identifier:CellWithIdentifier];
    ActiverTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellWithIdentifier];
    if (cell == nil) {
        cell = [[ActiverTableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellWithIdentifier];
    }
    [cell.nameLabel setText:data.achiverFileName];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yy年MM月dd日"];
    [cell.dateLabel setText:[formatter stringFromDate:data.achiverDate]];
    [cell.outMoneyLabel setText:[NSString stringWithFormat:@"%0.2f",data.outMoney]];
    [cell.inMoneyLabel setText:[NSString stringWithFormat:@"%0.2f",data.inMoney]];
    NSLog(@"getCell: out:%f,in:%f",data.outMoney,data.inMoney);
    return cell;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
